import { IEvent } from '@/core/interface/modules';
import { IParam } from '../../common';
import { IFormAbility } from '../ability';
import { ICtrlActionResult } from '../data-action';
import { IFormStore } from '../store';
import { IDECtrlController } from './i-de-ctrl-controller';

/**
 * 表单部件控制器接口
 *
 * @export
 * @interface IFormController
 * @extends {ICtrlController}
 */
export interface IFormController<S extends IFormStore, A extends IFormAbility>
	extends IDECtrlController<S, A> {
	/**
	 * 表单加载草稿
	 *
	 * @param {IParam} [opts] 行为参数
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IFormController
	 */
	loadDraft(opts?: IParam): Promise<ICtrlActionResult>;

	/**
	 * 处理表单组件行为
	 *
	 * @param {IEvent<string>} actionParam 行为参数
	 * @memberof IFormController
	 */
	handleComponentAction(actionParam: IEvent<string>): void;

	/**
	 * 值规则校验
	 *
	 * @return {*}  {Promise<boolean>}
	 * @memberof IFormController
	 */
	validate(): Promise<boolean>;
}
